﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL
{
    public static class GetPilot
    {
        #region Get Pilots

        static testdbsEntities ctx = new testdbsEntities();
        
        public static List<Pilot> GetPilots()
        {
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           select cs;

                return tPilot.ToList();
            

        }

        public static List<Pilot> GetPilots(Pilot mPilot)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs == mPilot
                                           select cs;

                return tPilot.ToList();
            

        }
        public static List<Pilot> GetPilotsById(int mId)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.id_pilot == mId
                                           select cs;
                return tPilot.ToList();
            
        }
        public static List<Pilot> GetPilotsByName(string mSname)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.sname == mSname
                                           select cs;
                return tPilot.ToList();
            
        }
        public static List<Pilot> GetPilotsByName(string mSname, string mName)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.sname == mSname && cs.name == mName
                                           select cs;
                return tPilot.ToList();
            
        }
        public static List<Pilot> GetPilotsByCompnay(string mCompany)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.company == mCompany
                                           select cs;
                return tPilot.ToList();
            
        }
        public static List<Pilot> GetPilotsByQvalification(string mQvalification)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.qualification == mQvalification
                                           select cs;
                return tPilot.ToList();
            
        }
        public static List<Pilot> GetPilotsByFlyTime(int mFlyTime)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.ftime == mFlyTime
                                           select cs;
                return tPilot.ToList();
            
        }
        public static List<Pilot> GetPilotsByFlyTimeRange(int mFlyTimeMin, int mFlyTimeMax)
        {
            
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.ftime >= mFlyTimeMin && cs.ftime <= mFlyTimeMax
                                           select cs;
                return tPilot.ToList();
           
        }
        public static List<Pilot> GetPilotsByBDate(DateTime mBDate)
        {
            
                IQueryable<Pilot> tPilot = from cs in ctx.Pilot
                                           where cs.bdate == mBDate
                                           select cs;
                return tPilot.ToList();
   
        }

       
        #endregion
    }
}
